package router;

import model.Router;

import java.util.Arrays;
import java.util.List;
import java.util.Random;

/**
 * 路由转发、负载均衡
 *
 * @author dsp
 * @date 2021-04-05
 */
public interface NettyHttpRouter {

    Router findRouter(String url);

    String route(Router router);

    /**
     * todo 这里先写个假的
     */
    default String format(String url) {
        List<String> list = Arrays.asList("demo1","demo2");
        int size = list.size();
        Random random = new Random(System.currentTimeMillis());
        return list.get(random.nextInt(size));
    }

}
